﻿@model Pager<SysUser>
@{
	ViewBag.Title = "系统用户列表";
}
<div class="ui-widget-header">
	<div style="padding: 5px 10px; font-size: 120%">
		@ViewBag.Title
	</div>
</div>
@using (Ajax.BeginForm(null,new AjaxOptions { UpdateTargetId = "Main" }))
{
	<div class="ui-cell">
		<label>登录名</label>
		@Html.TextBox("LoginName",Request["LoginName"])
	</div>
	<div class="ui-cell">
		<label>昵称</label>
		@Html.TextBox("NickName",Request["NickName"])
	</div>
	<div class="ui-cell-bar">
		<input class="btn" type="submit" value="查找" />
		@Ajax.ActionLink("添加", "Edit", null, new AjaxOptions { UpdateTargetId = "Main" }, new { @class = "btn" })
	</div>
}
<div class="ui-data">
	<table>
		<thead>
			<tr>
				<td colspan="11">@Html.Partial("Pager", Model)</td>
			</tr>
			<tr>
				<th>登录名</th>
				<th>昵称</th>
				<th>管理员</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			@foreach (var row in Model)
   {
			<tr>
				<td>@Html.DisplayFor(p=>row.LoginName)</td>
				<td>@Html.DisplayFor(p=>row.NickName)</td>
				<td>@Html.DisplayFor(p=>row.Available)</td>
				<td>
					@Ajax.ActionLink("[修改]", "Edit", new { ID = row.ID }, new AjaxOptions { UpdateTargetId = "Main" })
					@Html.ActionLink("[删除]", "Del", new { ID = row.ID }, new { @class = "subdel" })
				</td>
			</tr>
   }
			<tr>
				<td colspan="11">@Html.Partial("Pager", Model)</td>
			</tr>
		</tbody>
	</table>
</div>
<script type="text/javascript">
	$("a.subdel").click(function () {
		if (confirm("你真的要删除这条数据吗？")) {
			$.post($(this).attr("href"), {}, function (res) {
				res.res && $(".btn:submit").submit();
			})
		}
		return false;
	})
</script>